package com.htstar.ovms.admin.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.htstar.ovms.admin.api.dto.AppMenuTree;
import com.htstar.ovms.admin.api.dto.MenuTree;
import com.htstar.ovms.admin.api.entity.SysMenu;
import com.htstar.ovms.admin.api.entity.SysMenuLang;
import com.htstar.ovms.admin.api.entity.SysRoleMenu;
import com.htstar.ovms.admin.api.vo.MenuVO;
import com.htstar.ovms.admin.api.vo.TreeUtil;
import com.htstar.ovms.admin.mapper.SysMenuLangMapper;
import com.htstar.ovms.admin.mapper.SysMenuMapper;
import com.htstar.ovms.admin.mapper.SysRoleMenuMapper;
import com.htstar.ovms.admin.service.SysMenuLangService;
import com.htstar.ovms.admin.service.SysMenuService;
import com.htstar.ovms.common.core.constant.CacheConstants;
import com.htstar.ovms.common.core.constant.CommonConstants;
import com.htstar.ovms.common.core.constant.enums.MenuTypeEnum;
import com.htstar.ovms.common.core.i18n.MsgCode;
import com.htstar.ovms.common.core.util.R;
import com.htstar.ovms.common.security.service.OvmsUser;
import com.htstar.ovms.common.security.util.SecurityUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;

/**
 * <p>
 * 菜单权限表 服务实现类
 * </p>
 *
 * @author ovms
 * @since 2017-10-29
 */
@Service
@AllArgsConstructor
@Slf4j
public class SysMenuLangServiceImpl extends ServiceImpl<SysMenuLangMapper, SysMenuLang> implements SysMenuLangService {

    @Override
    public List<SysMenuLang> getLangTable() {
        QueryWrapper<SysMenuLang> sysMenuLangQueryWrapper = new QueryWrapper<>();
        List<SysMenuLang> tables = baseMapper.selectList(sysMenuLangQueryWrapper);
        return tables;
    }
}
